package com.luyue.zagj.view;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.luyue.zagj.R;

/**
 * Created by luyue on 2016/11/17.
 */

public class PoliceInsPopView extends BasePopupWindow implements View.OnClickListener {

    private View popupView;
    private ListView list;
    private TextView sure;
    private CheckBox cb;

    public PoliceInsPopView(Activity context) {
        super(context);
        sure = (TextView) mPopupView.findViewById(R.id.pop_sure_tv);
         cb= (CheckBox) mPopupView.findViewById(R.id.pop_sure_cb);
        sure.setOnClickListener(this);

    }

    @Override
    public Animation getAnimation() {
        return getTranslateAnimation(250 * 2, 0, 300);
    }

    @Override
    public AnimationSet getAnimationSet() {
        return null;
    }

    @Override
    public View getInputView() {
        return null;
    }

    @Override
    public View getDismissView() {
        return null;
    }

    @Override
    public View getPopupView() {
        popupView = LayoutInflater.from(mContext).inflate(R.layout.dialog_call_police_instructions, null);
        return popupView;
    }

    @Override
    public View getAnimaView() {
        return popupView.findViewById(R.id.pop_anima);
    }

    @Override
    public View getCloseView() {
        return null;
    }

    @Override
    public View getSureView() {
        return null;
    }
    private void bindEvent() {
        if (popupView!=null){

//            list= (ListView) popupView.findViewById(R.id.list_pop);
//            PopListAdapter adapter=new PopListAdapter(mContext,mlist);
//            popFootView=new PopFootView(mContext);
//            goodname= (TextView) popupView.findViewById(R.id.pop_good_name);
//            price= (TextView) popupView.findViewById(R.id.pop_good_price);
//            goodname.setText(mgoodname);
//            price.setText("￥"+mprice);
//            //数量
//            String n=String.valueOf(mnum);
//            popFootView.fillView(n,list);
//            list.setAdapter(adapter);
        }
    }


    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.pop_sure_tv:
                if (cb.isChecked()) {
                    dismiss();
                }else {
                   Toast.makeText(mContext,"请确认已阅读说明",Toast.LENGTH_SHORT).show();
                }

        }
    }
}
